<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    var myWorker = new SharedWorker("work.js");
    myWorker.port.onmessage = function (e) {
        console.log('Message received from worker');
        console.log(e);
    }
    myWorker.port.postMessage("aaa");
    // var myWorker = new Worker("work.js");
    // myWorker.onmessage = function (e) {
    //     console.log('Message received from worker');
    //     console.log(e);
    // }
    // myWorker.postMessage("aa");
</script>
</body>
</html>